home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / as / sprite / RCS / messages.c,v < prev    next >
Encoding:
Text File  |  1990-06-28  |  3.9 KB  |  199 lines

  1. head     1.2;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.2
  10. date     90.06.28.15.25.07;  author rab;  state Exp;
  11. branches ;
  12. next     1.1;
  13.  
  14. 1.1
  15. date     90.02.12.21.16.31;  author rab;  state Exp;
  16. branches ;
  17. next     ;
  18.  
  19.  
  20. desc
  21. @@
  22.  
  23.  
  24. 1.2
  25. log
  26. @Added some missing opcodes and fixed some misc bugs.
  27. @
  28. text
  29. @/* messages.c - error reporter -
  30.    Copyright (C) 1987 Free Software Foundation, Inc.
  31.  
  32. This file is part of GAS, the GNU Assembler.
  33.  
  34. GAS is free software; you can redistribute it and/or modify
  35. it under the terms of the GNU General Public License as published by
  36. the Free Software Foundation; either version 1, or (at your option)
  37. any later version.
  38.  
  39. GAS is distributed in the hope that it will be useful,
  40. but WITHOUT ANY WARRANTY; without even the implied warranty of
  41. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  42. GNU General Public License for more details.
  43.  
  44. You should have received a copy of the GNU General Public License
  45. along with GAS; see the file COPYING.  If not, write to
  46. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  47.  
  48. #include <stdio.h>        /* define stderr */
  49. #include "as.h"
  50. #ifndef NO_VARARGS
  51. #include <varargs.h>
  52. #endif
  53.  
  54. /*
  55.         ERRORS
  56.  
  57.     We print the error message 1st, beginning in column 1.
  58.     All ancillary info starts in column 2 on lines after the
  59.     key error text.
  60.     We try to print a location in logical and physical file
  61.     just after the main error text.
  62.     Caller then prints any appendices after that, begining all
  63.     lines with at least 1 space.
  64.  
  65.     Optionally, we may die.
  66.     There is no need for a trailing '\n' in your error text format
  67.     because we supply one.
  68.  
  69. as_warn(fmt,args)  Like fprintf(stderr,fmt,args) but also call errwhere().
  70.  
  71. as_fatal(fmt,args) Like as_warn() but exit with a fatal status.
  72.  
  73. */
  74.  
  75. extern int had_warnings;
  76.  
  77. /*
  78.  *            a s _ w a r n ( )
  79.  *
  80.  * Send to stderr a string (with bell) (JF: Bell is obnoxious!) as a warning, and locate warning
  81.  * in input file(s).
  82.  * Please only use this for when we have some recovery action.
  83.  * Please explain in string (which may have '\n's) what recovery was done.
  84.  */
  85.  
  86. #ifdef NO_VARARGS
  87. /*VARARGS1*/
  88. as_warn(Format,args)
  89. char *Format;
  90. {
  91.   if ( ! flagseen ['W'])    /* -W supresses warning messages. */
  92.     {
  93.       had_warnings = 1;
  94.       as_where();
  95.       _doprnt (Format, &args, stderr);
  96.       (void)putc ('\n', stderr);
  97.       /* as_where(); */
  98.     }
  99. }
  100. #else
  101. void
  102. as_warn(Format,va_alist)
  103. char *Format;
  104. va_dcl
  105. {
  106.   va_list args;
  107.  
  108.   if( ! flagseen['W'])
  109.     {
  110.       had_warnings = 1;
  111.       as_where();
  112.       va_start(args);
  113.       vfprintf(stderr, Format, args);
  114.       va_end(args);
  115.       (void) putc('\n', stderr);
  116.     }
  117. }
  118. #endif
  119. #ifdef DONTDEF
  120. void
  121. as_warn(Format,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an)
  122. char *format;
  123. {
  124.     if(!flagseen['W']) {
  125.             had_warnings = 1;
  126.         as_where();
  127.         fprintf(stderr,Format,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an);
  128.         (void)putc('\n',stderr);
  129.     }
  130. }
  131. #endif
  132. /*
  133.  *            a s _ f a t a l ( )
  134.  *
  135.  * Send to stderr a string (with bell) (JF: Bell is obnoxious!) as a fatal
  136.  * message, and locate stdsource in input file(s).
  137.  * Please only use this for when we DON'T have some recovery action.
  138.  * It exit()s with a warning status.
  139.  */
  140.  
  141. #ifdef NO_VARARGS
  142. /*VARARGS1*/
  143. as_fatal (Format, args)
  144. char *Format;
  145. {
  146.   as_where();
  147.   fprintf(stderr,"FATAL:");
  148.   _doprnt (Format, &args, stderr);
  149.   (void)putc ('\n', stderr);
  150.   /* as_where(); */
  151.   exit(42);            /* What is a good exit status? */
  152. }
  153. #else
  154. void
  155. as_fatal(Format,va_alist)
  156. char *Format;
  157. va_dcl
  158. {
  159.   va_list args;
  160.  
  161.   as_where();
  162.   va_start(args);
  163.   fprintf (stderr, "FATAL:");
  164.   vfprintf(stderr, Format, args);
  165.   (void) putc('\n', stderr);
  166.   va_end(args);
  167.   exit(42);
  168. }
  169. #endif
  170. #ifdef DONTDEF
  171. void
  172. as_fatal(Format,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an)
  173. char *Format;
  174. {
  175.   as_where();
  176.   fprintf (stderr, "FATAL:");
  177.   fprintf(stderr, Format,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an);
  178.   (void) putc('\n', stderr);
  179.   exit(42);
  180. }
  181. #endif
  182.  
  183. /* end: messages.c */
  184. @
  185.  
  186.  
  187. 1.1
  188. log
  189. @Initial revision
  190. @
  191. text
  192. @d47 1
  193. a48 1
  194.  
  195. d65 1
  196. d82 1
  197. d97 1
  198. @
  199.